<template>
    <view class="home_container">
		<view class="home_tab">
			<view class="home_tab_title">
				<uni-segmented-control :current="current" :values="items.map(v=>v.title)" @clickItem="onClickItem" styleType="text" activeColor="#d4237a"></uni-segmented-control>
			</view>
			
			<image src="../../static/search.png" class="home_tab_search"></image>
		</view>
    
        <view class="home_tab_content">
            <view v-if="current === 0">
                <homeRecomment/>
            </view>
            <view v-if="current === 1">
                <homeCategory/>
            </view>
            <view v-if="current === 2">
                <homeNew/>
            </view>
			<view v-if="current === 3">
			    <homeAlbum/>
			</view>
        </view>
    </view>
		
</template>

<script setup lang="ts">
	import {ref} from 'vue'
	import homeRecomment from './home_recomment';
	import homeCategory from './home_category';
	import homeNew from './home_new';
	import homeAlbum from './home_album';
	import { onLoad, onLaunch, onShow, onHide } from "@dcloudio/uni-app";
	import axios from '../../utils/request.js';
	// onLoad((option)=>{
		
	// });
	let items = [{title:"推荐"},{title:"分类"},{title:"最新"},{title:"专辑"}];
	let current = ref(0);
	
	const onClickItem = (e) =>{
		if(current.value !== e.currentIndex){
			current.value = e.currentIndex;
		}
	}
</script>

<style>
	.home_tab{
		height:80rpx;
		width: 100%;
		display: flex;
	}
	.home_tab_title{
		width:70%;
		margin-left: 10%;
	}
	.home_tab_search{
		width:35rpx;
		height:35rpx;
		margin-left: 5%;
		align-self: center;
	}
</style>
